﻿/*
*   积分
*/
angular.module('jisuStuHome')
.controller('integralList', ['$scope', '$rootScope', '$state', 'StuRequestTrain', 'interlocutionservice', 'sysUserInfo', 'Msg', 'T', 'LS', function ($scope, $rootScope, $state, ST, IS, sysUserInfo, Msg, T, LS) {

    $rootScope.twoparstr = "home.stuinfo.gerenxinxi";
    //初始
    $scope.init = function () {
        //查询的参数
        $scope.params = {
            xtype: "",
            xname: "",
            userid: sysUserInfo.getuserinfo().user_ID,
            order: "1",
            pageIndex: 1,
            pageSize: 10
        };
        $scope.integralLoading = false;
    }

    //返回首页
    $scope.goHome = function () {
        $rootScope.twoparstr = "home.stuinfo.gerenxinxi";
        $state.go($rootScope.twoparstr);
    }
    $scope.init();

    //查询列表
    $scope.getList = function (index) {
        $scope.integralLoading = true;
        IS.findStuIntergalDetails($scope.params).then(function (response) {
            $scope.integralLoading = false;
            if (response.errorcode == "0") {
                $scope.List = response.datas;
                $scope.paginationConf.totalItems = response.numCount;
                $scope.paginationConf.currentPage = response.pageIndex;
            } else {
                Msg.error("查询异常!")
            }
        }, function errorCallback() {
            $scope.integralLoading = false;
            console.log("连接服务器失败！");
        });
    }

    /*********************************************************************/
    //配置分页
    $scope.paginationConf = {
        currentPage: 1, //$location.search().currentPage ? $location.search().currentPage :  当前页码
        totalItems: 0,  // 总的记录数
        itemsPerPage: 10, // 每页显示多少条        
        perPageOptions: [10, 20],   // 每页显示记录数        
        onChange: function () {
            $scope.paginationConf.currentPage = $scope.paginationConf.currentPage == 0 ? 1 : $scope.paginationConf.currentPage;
            $scope.params.pageIndex = $scope.paginationConf.currentPage;
            $scope.params.pageSize = $scope.paginationConf.itemsPerPage;
            $scope.getList();
        }
    }
}]);




